<template>
  <div id="login">
    <div class="bingjing">
      <el-card class="box-card">
        <div>后台登录</div>
        <br />
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="账号">
            <el-input v-model="form.loginName"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input type="password" v-model="form.loginKey"></el-input>
          </el-form-item>
          <el-form-item label="记住我">
            <el-switch v-model="form.remeber"></el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">登录</el-button>
            <el-button>清空</el-button>
            <el-button type="text">新用户注册</el-button>
          </el-form-item>
        </el-form>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {},
    };
  },
  methods: {
    async onSubmit() {
      // TODO 表单验证
      await this.$store.dispatch("users/doLogin", this.form);
      this.$router.push("/msbd")
    },
  },
};
</script>

<style scoped>
.bingjing {
  width: 100%;
  height: 100%;
  background-image: url(../../assets/login.png);
}
#login {
  width: 100%;
  height: 100%;
}
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 480px;
  float: right;
  margin-top: 50px;
  margin-right: 50px;
}
</style>